-
Notifications
You must be signed in to change notification settings - Fork 345
Redefine view #4668
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Redefine view #4668
Conversation
@@ -130,7 +130,7 @@ func (s *Indexer) StartView(ctx context.Context) (staking.ContractStakeView, err | |||
} | |||
return &stakeView{ | |||
helper: s, | |||
cache: s.cache.Copy(), | |||
cache: s.cache.DeepClone(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clone or wrap
cache indexerCache | ||
bucketsByCandidate map[string]map[uint64]bool // buckets by candidate in current block | ||
updatedBuckets map[uint64]*Bucket // updated buckets in current block | ||
deletedBucketIds map[uint64]struct{} // deleted buckets in current block |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove field deletedBucketIds
, and replacing with updatedBuckets[idx] == nil
, may make things simpler
} | ||
|
||
func (w *wrappedCache) IsDirty() bool { | ||
return w.cache.IsDirty() || w.isDirty() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about whether to call cache.IsDirty()
}) | ||
v.contractsStake = clone |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the contractStake may have too many wraps, because there is no reset for it after 1 block committed
|
using "wrappedCache" to wrap a cache and record modifications
Fixes #(issue)
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Test Configuration:
Checklist: